#ifndef DYN_TARGET_MANAGER_PRIVATE_H
#define DYN_TARGET_MANAGER_PRIVATE_H
#include <qobject.h>
#include <qmap.h>
#include <QtXml/qdom.h>
#include "DynamicEntity.h"

struct TargetUnit
{
	QString name;
	QString icon;
	int width = 64;
	int height = 64;
	double scale = 1.0;
};

class DynTargetManagerPrivate : public QObject, public DynTargetManager
{
	Q_OBJECT
public:
	DynTargetManagerPrivate(QObject* parent = nullptr);
	~DynTargetManagerPrivate();
public:
	bool initialize(const QString& config = "..\\situation\\config.xml");

    DynTargetItemSet* createDynTargetItemSet(const QString& name = "dyntarget");
	bool containsDynTargetItemSet(const QString& name);
	QStringList getDynTargetItemSetList()const;
    bool removeTargetItemSet(DynTargetItemSet* set);

    bool defineDynamicTargetType(int code,const QString& nation,const QString& description,const QString& iconFile);
private:
	void parseColorNode(const QDomNode& node);
	void parseTargetConfigNode(const QDomNode& node,QMap<QString,TargetUnit>& mapper);
private:
	QMap<QString,DynTargetItemSet*> targetItemSet;

	QMap<QString,QString> nationColorMapper;
	QMap<QString,TargetUnit> civilTargetMapper;
	QMap<QString,TargetUnit> militaryTargetMapper;
};

#endif
